<template>
	<view class="content">
		<view v-if="content">
			<view class="news-title">{{title}}</view>
			<u-parse :html="content"></u-parse>
		</view>
		<mescroll-empty v-else></mescroll-empty>
	</view>
</template>

<script>
	import MescrollEmpty from '@/components/mescroll-uni/components/mescroll-empty.vue';
	export default {
		components: {
			MescrollEmpty
		},
		data() {
			return {
				title:"",
				content:""
			}
		},
		onLoad(options) {
			options.id&&this.getDetails(options.id);
		},
		methods: {
			async getDetails(id) {
				let res = await uniCloud.callFunction({
					name:'newsDetail',
					data:{
						id: id
					}
				});
				console.log(res);
				const data = res.result.data;
				if(data.length){
					this.title = data[0].title;
					this.content = data[0].content;
				}
			}
		}
	}
</script>

<style lang="scss" scope>
.content {
	padding: 30rpx;
	color: $u-content-color;
	font-size: 32rpx;
	line-height: 1.8;
	.article-title{
		font-size: 48rpx;
		margin-bottom: 30rpx;
	}
	// 标签形式无效
	p {
		color: $u-tips-color;
	}
}
</style>
